package com.qf.microuser.user.controller;

import com.qf.common.core.common.R;
import com.qf.microuser.user.pojo.dto.UserDTO;
import com.qf.microuser.user.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private IUserService userService;

    //注册

    @PostMapping("/register")
    public R register(@RequestBody UserDTO userDTO) {
        try {
            userService.register(userDTO);
            return R.ok();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
